﻿@namespace CyssBlazor.Shared.Components


@if (IsWhiteSpace)
{
    <div class="table-group table-group-whitespace" style="@Stryles" @ref="AnchorElement">
        @ChildContent
    </div>
}
else
{
    <div class="table-group" @ref="AnchorElement" style="@Stryles" >
        @ChildContent
    </div>
}

@code
{

    private string Stryles
    {

        get
        {
            if (MinHeight > 0)
            {
                return $"min-height: {this.MinHeight}px";
            }
            return string.Empty;
        }

    }

    [Parameter]
    public bool IsWhiteSpace { set; get; }

    private ElementReference AnchorElement { get; set; }

    [Parameter]
    public int MinHeight { set; get; }

    /// <summary>
    /// 获得/设置 IJSRuntime 实例
    /// </summary>
    [Inject]
    protected IJSRuntime _JSRuntime { get; set; }

    [Parameter]
    public RenderFragment ChildContent { get; set; }

    protected override Task OnAfterRenderAsync(bool firstRender)
    {
        //_JSRuntime.InvokeVoidAsync("setTableFixed", new object[] { AnchorElement });
        return base.OnAfterRenderAsync(firstRender);
    }


}